package com.originit.order.server.exception;

import com.originit.order.server.enums.ResultEnum;

public class OrderException extends RuntimeException{

    private Integer code;

    private String message;

    public static final Integer DEFAULT_CODE = -1;

    public OrderException(String message) {
        this.code = DEFAULT_CODE;
        this.message = message;
    }

    public OrderException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public OrderException(ResultEnum resultEnum){
        this(resultEnum.getCode(),resultEnum.getMessage());
    }

    public OrderException(ResultEnum resultEnum, String message){
        this(resultEnum.getCode(),message);
    }
}
